package com.example.shouybl.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.shouybl.R;
import com.example.shouybl.bean.GameData;
import com.example.shouybl.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;


import java.util.List;

/**
 * Created by Administrator on 2015/10/12.
 */
public class GameAdapter extends AppBaseAdapter<GameData> {

    private final DisplayImageOptions options;
    public GameAdapter(List<GameData> list, Context context) {
        super(list, context);
        options = ImageLoaderUtil.getDefaultOptions();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        GameData data=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_activity_layout);
        ImageView ivIcon= (ImageView) vh.findViewById(R.id.iv_activity_hotpic);
        TextView tvName= (TextView) vh.findViewById(R.id.tv_activity_shortname);
        TextView tvCountDl= (TextView) vh.findViewById(R.id.tv_activity_aname);
        TextView tvGameDesc= (TextView) vh.findViewById(R.id.total_join_user);
        TextView tvStatus= (TextView) vh.findViewById(R.id.tv_activity_status);
        ImageView ivImg= (ImageView) vh.findViewById(R.id.iv_activity_img);

        ImageLoader.getInstance().displayImage(data.getIcon(),ivIcon);
        tvName.setText(data.getName());
        tvCountDl.setText(data.getCount_dl()+"在玩");
        tvGameDesc.setText(data.getGame_desc());
        tvStatus.setText("");

        return vh;
    }
}
